import { Effect, Reducer, Subscription } from 'umi';

export interface Defaultcollapsed {
  collapsed: boolean;
}
export interface HomeModelType {
  namespace: 'home';
  state: Defaultcollapsed;
  reducers: {
    changeLayoutCollapsed: Reducer<Defaultcollapsed>;
    saveCollapsed: Reducer<Defaultcollapsed>;
  };
}

const HomeModel: HomeModelType = {
  namespace: 'home',
  state: {
    collapsed: false,
  },

  reducers: {
    changeLayoutCollapsed(state, { payload }): Defaultcollapsed {
      return {
        ...state,
        collapsed: !payload,
      };
    },
    saveCollapsed(state, { payload }): Defaultcollapsed {
      return {
        collapsed: false,
        ...state,
      };
    },
  },
};
export default HomeModel;
